{% extends 'layout.html' %}
{% load mytags %}
{% block content %}
    <div>
        <a href="{% url 'crm:customer_add' %}" class="btn btn-sm btn-primary">增加</a>
    </div>
    <form action="" class="form-inline pull-right">
        <input type="text" name="query" class="form-control">
        <button class="btn btn-warning btn-sm">搜索</button>
    </form>
    <form action="" method="post" class="form-inline">
        <select name="action" class="form-control">
            {% if request.path_info == url %}
                <option value="multi_apply">公户变私户</option>
            {% else %}
                <option value="multi_pub">私户变公户</option>
            {% endif %}
        </select>
        {% csrf_token %}
        <button class="btn btn-sm btn-primary">提交</button>
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th>选择</th>
                <th>序号</th>
                <th>qq</th>
                <th>性别</th>
                <th>手机号</th>
                <th>客户来源</th>
                <th>咨询课程</th>
                <th>班级类型</th>
                <th>状态</th>
                <th>最后跟进日期</th>
                <th>预计再次跟进时间</th>
                <th>销售</th>
                <th>已报班级</th>
                <th>操作</th>
            </tr>
            </thead>
            <tbody>
            {% for customer in customers %}
                <tr>
                    <td><input type="checkbox" name="pk" value="{{ customer.pk }}"></td>
                    <td>{{ forloop.counter }}</td>
                    <td>{{ customer.qq }}</td>
                    <td>{{ customer.get_sex_display }}</td>
                    <td>{{ customer.phone|default:'-' }}</td>
                    <td>{{ customer.get_source_display }}</td>
                    <td>{{ customer.course }}</td>
                    <td>{{ customer.get_class_type_display }}</td>
                    {{ customer.status_show|safe }}
                    <td>{{ customer.last_consult_date }}</td>
                    <td>{{ customer.next_date|default:'-' }}</td>
                    <td>{{ customer.consultant|default:'-' }}</td>
                    <td>{{ customer.class_show }}</td>
                    <td>
                        <a href="{% url_tag 'crm:customer_edit' request customer.pk %}"
                           class="btn btn-danger btn-sm">编辑</a>
                        <a href="{% url_tag 'crm:one_consult_record_list' request customer.pk %}"
                           class="btn btn-warning btn-sm">查看跟进</a>
                        <a href="{% url_tag 'crm:one_enrollment_list' request customer.pk %}"
                           class="btn btn-sm btn-success">查看报名表</a>
                        <a href="{% url_tag 'crm:enrollment_add' request customer.pk %}"
                           class="btn btn-sm btn-danger">添加报名表</a>
                        <a href="{% url_tag 'crm:one_payment_record_list' request customer.pk %}"
                           class="btn btn-sm btn-warning">查看缴费表</a>
                        <a href="{% url_tag 'crm:payment_record_add' request customer.pk %}"
                           class="btn btn-sm btn-success">添加缴费表</a>
                    </td>
                </tr>
            {% endfor %}
            </tbody>
        </table>
    </form>
    <nav aria-label="Page navigation">
        <ul class="pagination">
            {{ page_html }}
        </ul>
    </nav>
{% endblock %}
